HAL IWDG migration: List of applicable concepts ¶
This section provides information about the HAL IWDG applicable architecture concepts.
Concepts for IWDG ¶
|
Concept |
Description |
|---|---|
|
In HAL2, the
There is no configuration structure neither function, the IWDG parameters
|
|
|
The handle structure has been renamed to
|
|
|
|
|
|
New APIs are available to get and set IWDG features. |
|
|
Two functions to set and get user data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each IWDG event. These functions are used to register callback functions for different IWDG events. |
|
HAL IWDG APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL IWDG define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL IWDG driver, and equivalent services are ensured through the LL APIs. |
|
|
A state machine has been introduced in HAL2, comprising the following states:
|
|
|
The HAL IWDG functions were updated to return:
|
|
|
All TypeDef parts of the HAL IWDG driver have been removed and replaced by
|
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The parameters and state are checked using
|
|
|
Split Peripheral Configuration from Start in System HAL Drivers. |
Split the initialization into two function: init and start. |
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including IWDG instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL IWDG functions start with
|
Other HAL IWDG changes ¶
|
Concept |
Consideration |
|---|---|
|
The values for Prescaler, Counter, and Window are derived from the minimum and maximum times. |
In HAL1, the user manually calculates the values for
|
|
Allow dynamic updates of the IWDG timings based on the dynamic LSI frequency update. |
By using the define
|
|
Allow the IWDG to manage the LSI frequency divider (LSI_VALUE / 128). |
By using the define
|
|
Configure the IWDG to manage times in seconds (s), milliseconds (ms), and microseconds (µs). |
By using the define
This time unit apply to the
|